package Demo02;

import com.sun.media.jfxmediaimpl.HostUtils;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—14
 * Time: 16:13
 */
class Student{
    private String name;
    private String gender;
    private int age;
    private double score;
    private static String classRoom;

    public Student(){
        System.out.println("I am Student!");
    }
    {
        this.name = "zhang san";
        this.age = 24;
        this.score = 45.6;
        System.out.println("I am Instance!");
    }
    static {
        classRoom = "gao er 13 ban ";
        System.out.println("I am static");
    }
    public void Show(){
        System.out.println("name" + name + "age" + age + "score" + score);
    }
}
public class Test01 {
/*
    public static void main(String[] args) {
        {
            //1.普通代码块，直接用{}定义
            int x = 10;
            System.out.println("x1="+x);
        }
        int x = 100;
        System.out.println("x2="+x);
    }
*/
/*
public static void main(String[] args) {
    //2.构造代码块：定义在类中的代码块，也叫实例代码块
    //一般用于初始化实例成员变量
    Student  student = new Student();
    student.Show();
*/
public static void main(String[] args) {
    //3.静态代码块：用于初始化静态成员变量
    Student s1 = new Student();
    Student s2 = new Student();
}

}


